Skip to content

fix: enrichment metadata causing permanent redeploy indicator#55

Merged
TerrifiedBug merged 1 commit intomainfrom
fix/enrichment-redeploy-loop
Mar 7, 2026
Merged

fix: enrichment metadata causing permanent redeploy indicator#55
TerrifiedBug merged 1 commit intomainfrom
fix/enrichment-redeploy-loop

Conversation

@TerrifiedBug
Copy link
Copy Markdown
Owner

Summary

  • The hasUndeployedChanges check in pipeline.list calls generateVectorYaml() without the enrichment param, but the stored version YAML includes the injected vectorflow_metadata_enrich transform — so they never match, causing a permanent "Pending deploy" indicator
  • Pass the same enrichment param (environment name + deployed version number) to the comparison YAML generation so both sides are identical when no real changes exist
  • Added enrichMetadata and environment.name to the pipeline list query select

Test plan

  • Enable "Enrich with VectorFlow metadata" on a pipeline and deploy
  • Verify the pipelines list no longer shows "Pending deploy" after a successful deploy with no changes
  • Disable enrichment, deploy, and verify no false positive either
  • Make a real change with enrichment enabled and verify "Pending deploy" correctly appears

The pipeline list's change detection regenerates YAML from the graph and
compares it to the stored version YAML. When enrichMetadata is enabled,
the stored YAML includes the injected vectorflow_metadata_enrich
transform, but the comparison YAML did not — causing a permanent
"Pending deploy" indicator.

Pass the same enrichment param (environment name + version number) to
generateVectorYaml in the comparison path so both sides match.
@github-actions github-actions bot added the fix label Mar 7, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 7, 2026

Greptile Summary

This PR fixes a false-positive "Pending deploy" indicator that persisted permanently when the "Enrich with VectorFlow metadata" option was enabled on a pipeline. The root cause was that the hasUndeployedChanges comparison in pipeline.list was calling generateVectorYaml() without the enrichment parameter, producing YAML that was structurally different from the stored configYaml (which included the injected vectorflow_metadata_enrich transform), even when no real changes existed.

Key changes:

  • Added enrichMetadata and environment: { select: { name: true } } to the Prisma select in pipeline.list so the enrichment context is available during comparison.
  • Constructs the same enrichment object (using latestVersion.version — the deployed version number — and p.environment.name) that was used by createVersion's builder function at deploy time, and passes it to generateVectorYaml for the comparison.

Correctness of the approach: The deployed YAML stored in latestVersion.configYaml is generated with pipelineVersion = N (the version number atomically assigned when the PipelineVersion row is created). By using latestVersion.version (= N) in the comparison, both sides of the equality check now use identical enrichment parameters when no real changes have been made, resolving the false positive.

Confidence Score: 5/5

  • This PR is safe to merge — it is a targeted, correct fix with no security or data-integrity implications.
  • The change is minimal and well-reasoned. The comparison now uses the same pipelineVersion (the already-deployed version number from latestVersion.version) and environmentName that were embedded into the stored YAML at deploy time, making the two sides of the equality check symmetric. No new DB queries are added (fields are included in the existing Prisma select), no mutations are changed, and the fix does not affect the deploy path itself. The environment relation is a required FK so p.environment.name is always safe to access.
  • No files require special attention.

Important Files Changed

Filename Overview
src/server/routers/pipeline.ts Adds enrichMetadata and environment.name to the pipeline list select, then passes the matching enrichment object to generateVectorYaml during the hasUndeployedChanges comparison. The fix correctly mirrors what is stored in latestVersion.configYaml at deploy time (which uses the same version number via the builder function in createVersion), eliminating the permanent false-positive "Pending deploy" indicator.

Sequence Diagram

sequenceDiagram
    participant User
    participant PipelineList as pipeline.list (tRPC)
    participant DeployAgent as deploy.agent (tRPC)
    participant CreateVersion as createVersion()
    participant GenYaml as generateVectorYaml()
    participant DB as PostgreSQL

    Note over DeployAgent,CreateVersion: At deploy time (enrichMetadata = true)
    DeployAgent->>GenYaml: generateVectorYaml(nodes, edges, globalConfig, {environmentName, pipelineVersion: N+1})
    GenYaml-->>DeployAgent: configYaml (with .vectorflow.pipeline_version = N+1)
    DeployAgent->>CreateVersion: createVersion(pipelineId, (v) => buildYaml(v), ...)
    CreateVersion->>GenYaml: builder(N+1) → YAML embedded with version N+1
    CreateVersion->>DB: PipelineVersion { version: N+1, configYaml: "...pipeline_version = N+1..." }

    Note over PipelineList,DB: At pipeline.list query time (BEFORE this fix)
    PipelineList->>DB: SELECT latestVersion (version=N+1, configYaml)
    PipelineList->>GenYaml: generateVectorYaml(nodes, edges, globalConfig, null)
    GenYaml-->>PipelineList: currentYaml (NO enrichment transform)
    PipelineList->>PipelineList: currentYaml ≠ latestVersion.configYaml → hasUndeployedChanges = TRUE (false positive!)

    Note over PipelineList,DB: At pipeline.list query time (AFTER this fix)
    PipelineList->>DB: SELECT latestVersion (version=N+1, configYaml) + enrichMetadata + environment.name
    PipelineList->>GenYaml: generateVectorYaml(nodes, edges, globalConfig, {environmentName, pipelineVersion: N+1})
    GenYaml-->>PipelineList: currentYaml (with matching enrichment transform)
    PipelineList->>PipelineList: currentYaml === latestVersion.configYaml → hasUndeployedChanges = FALSE ✓
Loading

Last reviewed commit: 13797b3

@TerrifiedBug TerrifiedBug merged commit d41f4da into main Mar 7, 2026
12 checks passed
@TerrifiedBug TerrifiedBug deleted the fix/enrichment-redeploy-loop branch March 7, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant